<?php
//$objSearchForm = new BM_PHPForm();
//$objSearchForm->UseLocator();
//$objSearchForm->SetIndent("          ");
$arrMake = SearchDao::getArrMake();
//if ($objSearchForm->IsPost()){
//	if ($objSearchForm->IsValid()){
		$entSearch = new Search($objSearchForm->arrPostData['make'],$objSearchForm->arrPostData['model'],$objSearchForm->arrPostData['priceFrom'],$objSearchForm->arrPostData['priceTo'],$objSearchForm->arrPostData['yearFrom'],$objSearchForm->arrPostData['yearTo']);
		$result = SearchDao::search($entSearch);
//	}	
//}

//print $objSearchForm->ErrMsgs();
//print $objSearchForm->InfMsgs();
//print $objSearchForm->Open("searchform","Car Search");
//print $objSearchForm->HiddenField("action" ,"$action");
//print $objSearchForm->HiddenField("entity","$entity");
?>


	<form id="searchform" action="index_public.php" method="post" enctype="multipart/form-data">

	<div class="label"><label for="ddlRegion">Make:</label></div>
    <select ID="Select1" name="ddlRegion" onchange="FillTerritory(this,document.searchform.ddlTerritory)" >
<?php 
		while (list($strKey, $strVal) = each ($arrMake)) {
			if (isset($objSearchForm->arrPostData['ddlRegion']))
				{
				$strSelected = (($objSearchForm->arrPostData['ddlRegion'] == $strKey) ? " selected=\"selected\"" : "" );
				}elseif($strValue!="")
				{
				$strSelected = (($strValue == $strKey) ? " selected=\"selected\"" : "" );
				}
			$strOptions .= "            <option value=\"".$strKey."\"".$strSelected.">".$strVal."</option>\r\n";
		}
		echo $strOptions;
?>
  	</select>
<!-- 
    <div id="formfield-make" class="formfield">
	<div class="label"><label for="make">Region:</label></div>
	<div class="field">
	<select name="ddlRegion" onchange="FillTerritory(this,document.searchform.ddlTerritory)">
	   <option value="-1">Pick A Region</option>
	   <option value="1">Eastern</option>
	   <option value="2">Western</option>
	   <option value="3">Northern</option>
	   <option value="4">Southern</option>
	</select>	
	</div>
	</div>
 -->
	<div class="label"><label for="addTerritory">Territory:</label></div>
	<select name="ddlTerritory"></select>	
    <div class="clear"></div>
    
</form>
<?php
//print $objSearchForm->Select("make" ,"Make:",$arrMake);
//print $objSearchForm->TextBox("model" ,"Model:","");
//print $objSearchForm->TextBox("priceFrom" ,"Price From:","");
//print $objSearchForm->TextBox("priceTo" ,"Price To:","");
//print $objSearchForm->TextBox("yearFrom" ,"Year From:","");
//print $objSearchForm->TextBox("yearTo" ,"Year To:","");
//print $objSearchForm->SubmitButton("submit", "Search", array(), "submit");
//print $objSearchForm->Close();
?>